package br.com.amadeus.android.adapters;

import java.util.List;

import br.com.amadeus.android.activities.home.R;
import br.com.amadeus.android.business.FacadeAmadeusDroid;
import br.com.amadeus.android.entities.Course;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

public class ImageAdapter extends BaseAdapter{
    Context mContext;
    public static final int ACTIVITY_CREATE = 10;
    public ImageAdapter(Context c){
        mContext = c;
    }
    public int getCount() {
        // TODO Auto-generated method stub
        return 4;
    }

    public View getView(int position, View convertView, ViewGroup parent) {
        // TODO Auto-generated method stub
        View v;
        if(convertView==null){
        	LayoutInflater li = LayoutInflater.from(mContext);
        	v = li.inflate(R.layout.icon, null);
        	TextView tv = (TextView)v.findViewById(R.id.icon_text);
        	ImageView iv = (ImageView)v.findViewById(R.id.icon_image);
        	
        	List<Course> listCourses = FacadeAmadeusDroid.getInstance().getListCourse();
        	
        	switch (position) {
			case 0:
				tv.setText("(05) Usuários");
	            iv.setImageResource(R.drawable.community_users);
				break;
			case 1:
				tv.setText("(" + listCourses.size() + ") Cursos");
	            iv.setImageResource(R.drawable.mochila);
				break;
			case 2:
				tv.setText("Comunidade");
	            iv.setImageResource(R.drawable.logo_psp);
				break;
			case 3:
				tv.setText("Configurações");
	            iv.setImageResource(R.drawable.settings);
				break;
			default:
				return v;
			}
        }
        else
        {
            v = convertView;
        }
        return v;
    }
	public Object getItem(int position) {
		// TODO Auto-generated method stub
		return null;
	}
	public long getItemId(int position) {
		// TODO Auto-generated method stub
		return 0;
	}
}
